import React, { Component } from 'react';
import {
    View,
    Dimensions,
    StyleSheet,
    ListView,
    TouchableOpacity,
    Platform,
    WebView
} from 'react-native';

import { connect } from 'react-redux';
import { Container, Content, Text, Icon, Spinner } from 'native-base';
import { NavigationActions } from 'react-navigation';
import course from '../../net/course.js';
const { width, height } = Dimensions.get('window');
const marginTop = Platform.OS === 'ios' ? 20 : 0;

class Handouts extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        const { resourseURL } = this.props;
        console.log('webviewurl '+resourseURL.resourseURL);
        return (
            <View style={{ flex: 1 }}>
                <WebView style={styles.webview_style}
                    source={{uri:  'http://202.114.40.139/view/url?url='+resourseURL.resourseURL}}//"http://202.114.40.139/view/hUlwxAt"resourseURL.resourseURL'http://202.114.33.119:21563/v1/AUTH_system/dev_test/object-ea5e394b08_2017_03_03_11_45_23_GAHC_8727.pptx'
                    scalesPageToFit={true}
                >
                </WebView>
            </View>
        );
    }
}
var styles = StyleSheet.create(
    {
        webview_style: {

        },
    });
function mapStateToProps(state) {
    return { resourseURL: state.course.resourseURL }
}

function mapDispatchToProps(dispatch) {
    return {
    }
}

const HandoutsPage = connect(
    mapStateToProps,
    mapDispatchToProps
)(Handouts)
export default HandoutsPage;

